﻿package com.tudou.home.newskin.buttons
{
    import com.tudou.skin.*;
    import com.tudou.skin.common.bar.*;
    import com.tudou.utils.*;
    import flash.display.*;

    public class VolumeBar extends VolumeBarMC implements IBar
    {
        private var totalWidth:Number;
        protected var $barData:Object;

        public function VolumeBar()
        {
            $barData = {};
            totalWidth = this.barMask.width;
            BarUtil.actMouse(this);
            var _loc_1:Boolean = true;
            this.buttonMode = true;
            this.useHandCursor = _loc_1;
            return;
        }// end function

        public function isDragging() : Boolean
        {
            return $barData.isDragging;
        }// end function

        public function getValue() : Number
        {
            var _loc_1:* = getActMin();
            var _loc_2:* = getActMax();
            return MathUtil.unit((drag.x - _loc_1) / (_loc_2 - _loc_1));
        }// end function

        public function getSkin() : InteractiveObject
        {
            return this;
        }// end function

        public function get barData() : Object
        {
            return $barData;
        }// end function

        public function getMax() : Number
        {
            return totalWidth;
        }// end function

        public function setValue(param1:Number) : void
        {
            var _loc_2:* = getActMin();
            var _loc_3:* = getActMax();
            drag.x = _loc_2 + param1 * (_loc_3 - _loc_2);
            barMask.x = drag.x;
            return;
        }// end function

        public function getActMax() : Number
        {
            return int(totalWidth - drag.width / 2 + 1);
        }// end function

        public function set barData(param1:Object) : void
        {
            $barData = param1;
            return;
        }// end function

        public function getMin() : Number
        {
            return 0;
        }// end function

        public function getActMin() : Number
        {
            return int(drag.width / 2 + 1);
        }// end function

    }
}
